<template>
	<view class="cu-list menu card-menu margin-bottom-xl shadow-lg radius " style="background-color: #fff;">
		<view class="u-header"><text class="tips">试品编号:</text><text class="val">{{data.testCode}}</text></view>
		<view class="u-body">
			<view class="row">
				<view class="tips">重量(g)</view>
				<view class="val">{{data.testWeight}}</view>
			</view>
			<view class="row">
				<view class="tips">粒度</view>
				<view class="val">{{data.granularity}}</view>
			</view>
			<view class="row">
				<view class="tips">制样人</view>
				<view class="val">{{data.makeTestUname}}</view>
			</view>
			<view class="row">
				<view class="tips">制样时间</view>
				<view class="val">{{data.makeTestTime|timeStamp2}}</view>
			</view>
		</view>
		<view class="u-footer">
			<view class="btn" @tap="selectItem(data)">审核</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		name: 'u-test',
		computed: {

		},
		props: {
			data: {}
		},
		methods: {
			selectItem: function(o) {
				uni.setStorageSync("AUDIT_DATA", o);
				uni.navigateTo({
					url: '../../pages/audit/test_audit'
				})
			}
		},
		filters: {
			timeStamp: function(value) {
				if (!value) return '';
				var now = new Date(value);
				console.log("time:" + JSON.stringify(now));
				var year = now.getFullYear();
				var month = now.getMonth() + 1;
				if (month < 10) {
					month = '0' + month
				}
				var date = now.getDate();
				if (date < 10) {
					date = '0' + date
				}
				return year + "-" + month + "-" + date
			},
			timeStamp2: function(value) { //具体到时分秒
				var date = new Date(value); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
				var year = date.getFullYear();
				var month = ("0" + (date.getMonth() + 1)).slice(-2);
				var sdate = ("0" + date.getDate()).slice(-2);
				var hour = ("0" + date.getHours()).slice(-2);
				var minute = ("0" + date.getMinutes()).slice(-2);
				var second = ("0" + date.getSeconds()).slice(-2);
				// 拼接
				var result = year + "-" + month + "-" + sdate + " " + hour + ":" + minute + ":" + second;
				// 返回
				return result;
			}
		}
	}
</script>

<style>
</style>
